USE [master]
GO
DROP DATABASE [SiteRecord]
/****** Object:  Database [SiteRecord]    Script Date: 08/24/2012 22:50:26 ******/
CREATE DATABASE [SiteRecord] ON  PRIMARY 
( NAME = N'SiteRecord', FILENAME = N'c:\DataBase\SiteRecord.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'SiteRecord_log', FILENAME = N'c:\DataBase\SiteRecord_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
ALTER DATABASE [SiteRecord] SET COMPATIBILITY_LEVEL = 100
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [SiteRecord].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [SiteRecord] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [SiteRecord] SET ANSI_NULLS OFF
GO
ALTER DATABASE [SiteRecord] SET ANSI_PADDING OFF
GO
ALTER DATABASE [SiteRecord] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [SiteRecord] SET ARITHABORT OFF
GO
ALTER DATABASE [SiteRecord] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [SiteRecord] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [SiteRecord] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [SiteRecord] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [SiteRecord] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [SiteRecord] SET CURSOR_DEFAULT  GLOBAL
GO
ALTER DATABASE [SiteRecord] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [SiteRecord] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [SiteRecord] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [SiteRecord] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [SiteRecord] SET  DISABLE_BROKER
GO
ALTER DATABASE [SiteRecord] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [SiteRecord] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [SiteRecord] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [SiteRecord] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [SiteRecord] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [SiteRecord] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [SiteRecord] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [SiteRecord] SET  READ_WRITE
GO
ALTER DATABASE [SiteRecord] SET RECOVERY FULL
GO
ALTER DATABASE [SiteRecord] SET  MULTI_USER
GO
ALTER DATABASE [SiteRecord] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [SiteRecord] SET DB_CHAINING OFF
GO
EXEC sys.sp_db_vardecimal_storage_format N'SiteRecord', N'ON'
GO
USE [SiteRecord]
GO
/****** Object:  Table [dbo].[Users]    Script Date: 08/24/2012 22:50:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Users](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](500) NOT NULL,
	[Pwd] [varchar](500) NOT NULL,
	[Singdata] [datetime] NULL,
	[Key] [uniqueidentifier] NULL,
 CONSTRAINT [PK_Users] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[UserSites]    Script Date: 08/24/2012 22:50:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[UserSites](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Userid] [int] NOT NULL,
	[SiteName] [varchar](500) NULL,
	[Url] [varchar](500) NULL,
	[Modifydate] [datetime] NULL,
	[LastRecordTime] [datetime] NULL,
	[LastRecordCount] [datetime] NULL,
	[LastRecordDate] [datetime] NULL,
 CONSTRAINT [PK_UserSites] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Records]    Script Date: 08/24/2012 22:50:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Records](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[UserSiteID] [int] NOT NULL,
	[RecordCount] [int] NOT NULL,
	[RecordDate] [datetime] NOT NULL,
	[SnapshotUrl] [varchar](500) NULL,
	[ModifyDate] [datetime] NOT NULL,
 CONSTRAINT [PK_Records] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Default [DF_UserSites_Modifydate]    Script Date: 08/24/2012 22:50:27 ******/
ALTER TABLE [dbo].[UserSites] ADD  CONSTRAINT [DF_UserSites_Modifydate]  DEFAULT (getdate()) FOR [Modifydate]
GO
/****** Object:  Default [DF_Records_ModifyDate]    Script Date: 08/24/2012 22:50:27 ******/
ALTER TABLE [dbo].[Records] ADD  CONSTRAINT [DF_Records_ModifyDate]  DEFAULT (getdate()) FOR [ModifyDate]
GO
/****** Object:  ForeignKey [FK_UserSites_Users]    Script Date: 08/24/2012 22:50:27 ******/
ALTER TABLE [dbo].[UserSites]  WITH CHECK ADD  CONSTRAINT [FK_UserSites_Users] FOREIGN KEY([Userid])
REFERENCES [dbo].[Users] ([ID])
GO
ALTER TABLE [dbo].[UserSites] CHECK CONSTRAINT [FK_UserSites_Users]
GO
/****** Object:  ForeignKey [FK_Records_UserSites]    Script Date: 08/24/2012 22:50:27 ******/
ALTER TABLE [dbo].[Records]  WITH CHECK ADD  CONSTRAINT [FK_Records_UserSites] FOREIGN KEY([UserSiteID])
REFERENCES [dbo].[UserSites] ([ID])
GO
ALTER TABLE [dbo].[Records] CHECK CONSTRAINT [FK_Records_UserSites]
GO
